<navbar></navbar>
<div style="margin-top:5%; width:1300px; margin-left:15%; font-size:18px;">
<div  id="addrform" style=" font-size:25px;">
        <div class="input-group">
            
            <span class="input-group-addon" id="sizing-addon2">收货人</span>
            <input type="text" ng-model="contact" ng-change="vm.contactsave(contact)" class="form-control" placeholder="请输入您的姓名" aria-describedby="sizing-addon2">
        </div>

        <div class="input-group">
            <span class="input-group-addon" id="sizing-addon2">手机号</span>
            <input type="text" ng-model="tel" ng-change="vm.telsave(tel)" class="form-control" placeholder="配送员联系您的电话" aria-describedby="sizing-addon2">
        </div>

        <div class="input-group">
            <span class="input-group-addon" id="sizing-addon2">收货地址</span>
            <select class="form-control" ng-model="address.province" ng-options="key as key for (key,value) in division"  
                    ng-change="address.city='';address.district='';">
                <option value="">省</option>
            </select>  
            <select class="form-control" ng-model="address.city" ng-options="key as key for (key,value) in division[address.province]"  
                    ng-change="address.district='';">
                <option value="">市</option>
            </select>  
            <select class="form-control" ng-model="address.district" ng-options="value as value for value in division[address.province][address.city]"
                    ng-change="vm.newaddr(address.province,address.city,address.district)">
                <option value="">区</option>
            </select>
        </div>

        <div>
            <button class="btn btn-primary" type="button" ng-click="vm.save()">保存设置</button>
        </div>
    </div>

<hr>
     <h3 style="text-align:center">历史使用地址</h3>
<div id="deliv_info_list">
    <table class="table table-hover table-condensed">
                <thead>
                    <tr>
                        <th rowspan="1"><input type="checkbox" ng-model="vm.allChecked" ng-change="vm.checkAll(vm.allChecked)" /></th>
                        <th rowspan="2">收件人</th>
                        <th rowspan="2">联系电话</th>
                        <th rowspan="4">配送地址</th>
                        <th rowspan="2"></th>
                        <th rowspan="2">修改</th>
                        <th rowspan="2">删除</th>
                    </tr>
                </thead>

                <tbody>
                    <tr ng-repeat="item in vm.dinfos">
                        <td><input type="checkbox" ng-model="item.$checked" /></td>
                        <td>
                            <span ng-show="!vm.isEditable[$index]" >{{item.contact}}</span>
                            <input ng-show="vm.isEditable[$index]" ng-model="vm.newcontact" type="text" ng-value="item.contact" ng-keypress="edit($index);">
                        </td>
                        <td>
                            <span ng-show="!vm.isEditable[$index]">{{item.tel}}</span>
                            <input ng-show="vm.isEditable[$index]"  ng-model="vm.newtel" type="text" ng-value="item.tel" ng-keypress="edit($index);">
                        </td>
                        <td>
                            <span ng-show="!vm.isEditable[$index]">{{item.addr}}</span>
                            <select  ng-show="vm.isEditable[$index]" class="form-control" ng-model="address.province" ng-options="key as key for (key,value) in division"  
                                    ng-change="address.city='';address.district='';" >
                                <option value="">省</option>
                            </select>  
                            <select  ng-show="vm.isEditable[$index]"  class="form-control" ng-model="address.city" ng-options="key as key for (key,value) in division[address.province]"  
                                    ng-change="address.district='';" >
                                <option value="">市</option>
                            </select>  
                            <select  ng-show="vm.isEditable[$index]"  class="form-control" ng-model="address.district" ng-options="value as value for value in division[address.province][address.city]"
                                    ng-change="vm.newaddr(address.province,address.city,address.district)" >
                                <option value="">区</option>
                            </select>
                        </td>
                        <td>
                            <button  ng-show="vm.isEditable[$index]" type="button" class="btn btn-info pull-right" ng-click="vm.editsave($index, item._id)">
                                Save
                            </button>
                        </td>
                        <td>
                            <button type="button" class="btn btn-info pull-right" ng-click="vm.isEditable[$index] = true">
                                Edit
                            </button>
                        </td>
                        <td>
                            <button type="button" class="btn btn-danger pull-right" ng-click="vm.delete($index)">
                                Delete
                            </button>
                        </td>
                    </tr>
                </tbody>
            </table>
        
</div>
</div>
